package com.ruoyi.iptv.channel.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.iptv.channel.mapper.IptvPublicChannelMapper;
import com.ruoyi.iptv.channel.domain.IptvPublicChannel;
import com.ruoyi.iptv.channel.service.IIptvPublicChannelService;
import com.ruoyi.common.core.text.Convert;

/**
 * 公共内容Service业务层处理
 * 
 * @author 玉念聿辉
 * @date 2021-10-20
 */
@Service
public class IptvPublicChannelServiceImpl implements IIptvPublicChannelService 
{
    @Autowired
    private IptvPublicChannelMapper iptvPublicChannelMapper;

    /**
     * 查询公共内容
     * 
     * @param id 公共内容主键
     * @return 公共内容
     */
    @Override
    public IptvPublicChannel selectIptvPublicChannelById(Long id)
    {
        return iptvPublicChannelMapper.selectIptvPublicChannelById(id);
    }

    /**
     * 查询公共内容列表
     * 
     * @param iptvPublicChannel 公共内容
     * @return 公共内容
     */
    @Override
    public List<IptvPublicChannel> selectIptvPublicChannelList(IptvPublicChannel iptvPublicChannel)
    {
        return iptvPublicChannelMapper.selectIptvPublicChannelList(iptvPublicChannel);
    }

    /**
     * 新增公共内容
     * 
     * @param iptvPublicChannel 公共内容
     * @return 结果
     */
    @Override
    public int insertIptvPublicChannel(IptvPublicChannel iptvPublicChannel)
    {
        iptvPublicChannel.setCreateTime(DateUtils.getNowDate());
        return iptvPublicChannelMapper.insertIptvPublicChannel(iptvPublicChannel);
    }

    /**
     * 修改公共内容
     * 
     * @param iptvPublicChannel 公共内容
     * @return 结果
     */
    @Override
    public int updateIptvPublicChannel(IptvPublicChannel iptvPublicChannel)
    {
        iptvPublicChannel.setUpdateTime(DateUtils.getNowDate());
        return iptvPublicChannelMapper.updateIptvPublicChannel(iptvPublicChannel);
    }

    /**
     * 批量删除公共内容
     * 
     * @param ids 需要删除的公共内容主键
     * @return 结果
     */
    @Override
    public int deleteIptvPublicChannelByIds(String ids)
    {
        return iptvPublicChannelMapper.deleteIptvPublicChannelByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除公共内容信息
     * 
     * @param id 公共内容主键
     * @return 结果
     */
    @Override
    public int deleteIptvPublicChannelById(Long id)
    {
        return iptvPublicChannelMapper.deleteIptvPublicChannelById(id);
    }
}
